package com.ruoyi.web.wrapper;

import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.wrapper.BaseControllerWrapper;
import com.ruoyi.merchantdata.enums.DataStatusEnum;
import com.ruoyi.merchantdata.enums.StarTypeEnum;

import java.util.List;
import java.util.Map;

public class MerchantDataAllocateInfoWrapper extends BaseControllerWrapper {

    public MerchantDataAllocateInfoWrapper(Map<String, Object> single) {
        super(single);
    }

    public MerchantDataAllocateInfoWrapper(List<Map<String, Object>> multi) {
        super(multi);
    }

    @Override
    public void wrapTheMap(Map<String, Object> map) {

        try {
            Long uid = (Long) map.get("uid");
            if (ObjectUtil.isNotEmpty(uid)){
                map.put("uid", uid+"");
            }

            Integer starNumber = (Integer) map.get("starNumber");
            if (ObjectUtil.isNotEmpty(starNumber)){
                map.put("starNumberName", StarTypeEnum.getNameByValue(starNumber));
            }

            Integer stateInfo = (Integer) map.get("stateInfo");
            if (ObjectUtil.isNotEmpty(stateInfo)){
                map.put("stateInfoName", DataStatusEnum.getNameByValue(stateInfo));
            }

        }catch (Exception ex){
            ex.printStackTrace();
        }
    }

}
